﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ChuanYe.CountyFireManagement.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace ChuanYe.CountyFireManagement.Api.Controllers
{
    /// <summary>
    /// 提供基础枚举键值列表
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BasicEnumController : ControllerBase
    {
        /// <summary>
        ///  处置类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ResultDto<dynamic> GetMRecordEnum()
        {
            ResultDto<dynamic> result = new ResultDto<dynamic>();
            try
            {
                result.FirstParam = FireInfoTool.RecordEnum();
            }
            catch (Exception ex)
            {
                result.Status = 500;
                result.Message = "/BasicEnum/GetMRecordEnum Error";
                LogHelper.Error(result.Message,ex);
            }
            return result;
        }

        /// <summary>
        ///  消息类型
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        [HttpPost]
        public ResultDto<dynamic> GetMessageEnum()
        {
            ResultDto<dynamic> result = new ResultDto<dynamic>();
            try
            {
                result.FirstParam = FireInfoTool.MessageEnum();
            }
            catch (Exception ex)
            {
                result.Status = 500;
                result.Message = "/BasicEnum/GetMessageEnum Error";
                LogHelper.Error(result.Message,ex);
            }
            return result;
        }

        /// <summary>
        ///  消息发送类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ResultDto<dynamic> GetMessageSendEnum()
        {
            ResultDto<dynamic> result = new ResultDto<dynamic>();
            try
            {
                result.FirstParam = FireInfoTool.MessageSendEnum();
            }
            catch (Exception ex)
            {
                result.Status = 500;
                result.Message = "/BasicEnum/GetMessageSendEnum Error";
                LogHelper.Error(result.Message,ex);
            }
            return result;
        }

        /// <summary>
        ///  火灾接警类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ResultDto<dynamic> GetFireAlarmTypeEnum()
        {
            ResultDto<dynamic> result = new ResultDto<dynamic>();
            try
            {
                result.FirstParam = BLL.FireAlarmTypeBLL.Instance.Get();
            }
            catch (Exception ex)
            {
                result.Status = 500;
                result.Message = "/BasicEnum/GetFireAlarmTypeEnum Error";
                LogHelper.Error(result.Message,ex);
            }
            return result;
        }

        /// <summary>
        ///  起火原因类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ResultDto<dynamic> GetFireCauseEnum()
        {
            ResultDto<dynamic> result = new ResultDto<dynamic>();
            try
            {
                result.FirstParam = BLL.FireCauseBLL.Instance.Get();
            }
            catch (Exception ex)
            {
                result.Status = 500;
                result.Message = "/BasicEnum/GetFireCauseEnum Error";
                LogHelper.Error(result.Message,ex);
            }
            return result;
        }

    }
}